package day0517;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;

public class TestDir {
    public static void main(String[] args) throws IOException {
        File f=new File("src");

        boolean isF=f.isFile();
        System.out.println(isF);

        boolean isD=f.isDirectory();  //Directory:目录
        System.out.println(isD);
        System.out.println(f.getAbsolutePath());
        System.out.println(f.getPath());//相对路径
        System.out.println(f.getName());
        System.out.println(f.lastModified());
        System.out.println(f.length());
        //f.delete();

        File[] fs=f.listFiles();
        for(File fe: fs){
            System.out.println(fe.getName());
        }

        File[] fs2=f.listFiles(new FileFilter(){
            public boolean accept(File fe) {
                return fe.getName().startsWith("day");
            }
        });
        for(File fe: fs2){
            System.out.println(fe.getName());
        }
    }
}
